#include "dialogmain.h"
#include <qtsingleapplication.h>

int main(int argc, char *argv[])
{
    QtSingleApplication instance("CubeUpdate", argc, argv);
    QString args;
    for (int a=1; a<argc; a++) {
        args += argv[a];
        if (a < argc-1) {
            args += " ";
        }
    }
    if (instance.sendMessage(args)) {
        return 0;
    }

    DialogMain dialogMain;
    dialogMain.onParseArgs(args);
    dialogMain.setWindowFlags(Qt::WindowMaximizeButtonHint);
    dialogMain.show();

    QObject::connect(&instance, SIGNAL(messageReceived(const QString&)), &dialogMain, SLOT(onParseArgs(const QString&)));
    instance.setActivationWindow(&dialogMain, false);
    QObject::connect(&dialogMain, SIGNAL(signalNeedToShow()), &instance, SLOT(activateWindow()));

    return instance.exec();
}
